object DBUnit: TDBUnit
  OldCreateOrder = False
  OnCreate = DataModuleCreate
  OnDestroy = DataModuleDestroy
  Height = 239
  Width = 465
  object DB: TpFIBDatabase
    AutoReconnect = True
    DBName = '91.144.190.4:d:\base\VNO.fdb'
    DBParams.Strings = (
      'user_name=SYSDBA'
      'password=victris'
      'lc_ctype=WIN1251')
    DefaultTransaction = RT
    DefaultUpdateTransaction = WT
    SQLDialect = 3
    Timeout = 0
    LibraryName = 'fbclient.dll'
    WaitForRestoreConnect = 0
    Left = 32
    Top = 24
  end
  object RT: TpFIBTransaction
    DefaultDatabase = DB
    TimeoutAction = TARollback
    TRParams.Strings = (
      'read'
      'nowait'
      'rec_version'
      'read_committed')
    TPBMode = tpbDefault
    Left = 56
    Top = 24
  end
  object WT: TpFIBTransaction
    DefaultDatabase = DB
    TimeoutAction = TARollback
    TRParams.Strings = (
      'write'
      'nowait'
      'concurrency')
    TPBMode = tpbDefault
    Left = 80
    Top = 24
  end
  object Zone: TpFIBDataSet
    SelectSQL.Strings = (
      'select * from Zone order by Name')
    AutoUpdateOptions.UpdateTableName = 'ZONE'
    AutoUpdateOptions.AutoReWriteSqls = True
    AutoUpdateOptions.CanChangeSQLs = True
    AutoUpdateOptions.UpdateOnlyModifiedFields = True
    AutoUpdateOptions.AutoParamsToFields = True
    AutoUpdateOptions.SeparateBlobUpdate = True
    Transaction = RT
    Database = DB
    UpdateTransaction = WT
    AutoCommit = True
    Left = 32
    Top = 72
  end
  object VType: TpFIBDataSet
    SelectSQL.Strings = (
      'select * from VType')
    AutoUpdateOptions.UpdateTableName = 'VTYPE'
    AutoUpdateOptions.AutoReWriteSqls = True
    AutoUpdateOptions.CanChangeSQLs = True
    AutoUpdateOptions.UpdateOnlyModifiedFields = True
    AutoUpdateOptions.AutoParamsToFields = True
    AutoUpdateOptions.SeparateBlobUpdate = True
    Transaction = RT
    Database = DB
    UpdateTransaction = WT
    AutoCommit = True
    Left = 64
    Top = 72
  end
  object Kontragent: TpFIBDataSet
    SelectSQL.Strings = (
      'select * from Kontragent order by Name')
    AutoUpdateOptions.UpdateTableName = 'KONTRAGENT'
    AutoUpdateOptions.AutoReWriteSqls = True
    AutoUpdateOptions.CanChangeSQLs = True
    AutoUpdateOptions.UpdateOnlyModifiedFields = True
    AutoUpdateOptions.AutoParamsToFields = True
    AutoUpdateOptions.SeparateBlobUpdate = True
    Transaction = RT
    Database = DB
    UpdateTransaction = WT
    AutoCommit = True
    Left = 264
    Top = 72
  end
  object TimeSQL: TpFIBQuery
    Transaction = RT
    Database = DB
    SQL.Strings = (
      'select RDB$Relation_ID from RDB$DataBase')
    Left = 376
    Top = 16
  end
  object Timer: TTimer
    Interval = 10000
    OnTimer = TimerTimer
    Left = 408
    Top = 16
  end
  object Shema: TpFIBDataSet
    SelectSQL.Strings = (
      'select a.Code, '
      '       iif(X='#39'0'#39', 0, 1) IsMarker,'
      '       a.IsMark,'
      '       a.IsShema, '
      '       a.IsPlace, '
      '       a.IsCDoc, '
      '       a.IsRDoc, '
      '       IIF(a.Picture is null, 0, 1) IsFoto,'
      '       a.SQ,'
      '       a.SQT, '
      '       a.Zone,'
      '       a.Addr,'
      '       a.Num,'
      '       a.Note,'
      '       a.X,'
      '       a.Y,'
      '       a.Kontragent, '
      '       a.VType,'
      '       a.SType,'
      '       a.EType,'
      '       a.PShema, '
      '       a.CDoc, '
      '       a.CDoc1, '
      '       a.RDoc,'
      '       a.ANom,'
      '       a.AData,'
      '       a.KZNom,'
      '       a.KZData,'
      '       a.KZPub,'
      '       c.Name VTypeName,'
      '       d.Data Data_CDoc,'
      '       e.Data Data_CDoc1,'
      '       f.Data Data_RDoc,'
      '       (select Info from GetLastZDocInfo(a.Code)) ZInfo,'
      '       (select Info from GetLastRDocInfo(a.Code)) RInfo,'
      '       (select Info from GetLastCDocInfo1(a.Code)) CInfo,'
      '       (select Answer from GetLastCDocInfo2(a.Code)) Answer'
      'from Shema a'
      '     left outer join Kontragent b on b.Code = a.Kontragent'
      '     left outer join VType c on c.Code = a.VType'
      '     left outer join CDoc d on d.Code = a.CDoc'
      '     left outer join CDoc e on e.Code = a.CDoc1'
      '     left outer join RDoc f on f.code = a.RDoc'
      '')
    AutoUpdateOptions.UpdateTableName = 'SHEMA'
    AutoUpdateOptions.AutoReWriteSqls = True
    AutoUpdateOptions.CanChangeSQLs = True
    AutoUpdateOptions.UpdateOnlyModifiedFields = True
    AutoUpdateOptions.AutoParamsToFields = True
    AutoUpdateOptions.SeparateBlobUpdate = True
    BeforeCancel = MarkerBeforeCancel
    Transaction = RT
    Database = DB
    UpdateTransaction = WT
    AutoCommit = True
    Left = 312
    Top = 72
  end
  object ZDoc: TpFIBDataSet
    SelectSQL.Strings = (
      'select '
      '  iif(a.Shema=0, 0, 1) IsShema,'
      '  iif(a.CDoc=0, 0, 1) IsCDoc,'
      '  a.Code,'
      '  a.State,'
      '  a.Nomer,'
      '  a.Data,'
      '  a.ZType,'
      '  a.SType,'
      '  a.PR,'
      '  a.Zone,'
      '  a.Addr,'
      '  a.SQ,'
      '  a.Kontragent,'
      '  a.VType,'
      '  a.PType,'
      '  a.Note,'
      '  sp.Answer,'
      '  sp.Note AnswerNote,'
      '  a.Shema,'
      '  a.AM,'
      '  a.Kontragent_,'
      '  a.VType_,'
      '  a.Addr_,'
      '  a.SQ_,'
      '  a.LastCDoc,'
      '  e.Code ETypeCode,'
      '  (select Info from GetLastCDocInfo(a.Code)) LastCDocInfo,'
      '  coalesce(s.Num, 0) Num'
      'from ZDoc a'
      'left outer join Shema s on (s.Code = a.Shema)'
      'left outer join EType e on (e.Code = s.EType)'
      
        'left outer join CDocSpec sp on (sp.Code=(select Code from GetLas' +
        'tCDocSpec(a.Code)))')
    AutoUpdateOptions.UpdateTableName = 'ZDOC'
    AutoUpdateOptions.AutoReWriteSqls = True
    AutoUpdateOptions.CanChangeSQLs = True
    AutoUpdateOptions.UpdateOnlyModifiedFields = True
    AutoUpdateOptions.AutoParamsToFields = True
    AutoUpdateOptions.SeparateBlobUpdate = True
    Transaction = RT
    Database = DB
    UpdateTransaction = WT
    AutoCommit = True
    Left = 240
    Top = 128
  end
  object ZDocType: TpFIBDataSet
    SelectSQL.Strings = (
      'select * from ZDocType order by Code')
    AutoUpdateOptions.UpdateTableName = 'ZDocType'
    AutoUpdateOptions.KeyFields = 'Code'
    Transaction = RT
    Database = DB
    AutoCommit = True
    Left = 40
    Top = 176
  end
  object ZDocAnswer: TpFIBDataSet
    SelectSQL.Strings = (
      'select * from ZDocAnswer order by Name')
    AutoUpdateOptions.UpdateTableName = 'ZDocType'
    AutoUpdateOptions.KeyFields = 'Code'
    Transaction = RT
    Database = DB
    AutoCommit = True
    Left = 96
    Top = 176
  end
  object RDoc: TpFIBDataSet
    SelectSQL.Strings = (
      'select '
      '  a.Code,'
      '  a.SHEMA,'
      '  a.NOMER,'
      '  a.DATA,'
      '  a.DODATE,'
      '  a.NOTE,'
      '  a.STATE,'
      '  s.Addr,'
      '  z.Code Zone,'
      '  k.Name KName,'
      '  v.Name VName,'
      '  d.Name SName'
      'from RDoc a'
      'left outer join Shema s on (s.Code=a.Shema)'
      'left outer join Kontragent k on (k.Code=s.Kontragent)'
      'left outer join VType v on (v.Code=s.VType)'
      'left outer join SType d on (d.Code=s.SType)'
      'left outer join Zone z on (z.Code=s.Zone)'
      'order by Data')
    AutoUpdateOptions.UpdateTableName = 'RDOC'
    AutoUpdateOptions.AutoReWriteSqls = True
    AutoUpdateOptions.CanChangeSQLs = True
    AutoUpdateOptions.UpdateOnlyModifiedFields = True
    AutoUpdateOptions.AutoParamsToFields = True
    AutoUpdateOptions.SeparateBlobUpdate = True
    Transaction = RT
    Database = DB
    UpdateTransaction = WT
    AutoCommit = True
    Left = 304
    Top = 128
  end
  object CDoc: TpFIBDataSet
    SelectSQL.Strings = (
      'select '
      '  Code,'
      '  Nomer,'
      '  Data,'
      
        '  Nomer || '#39' '#1086#1090' '#39' || extract(Day from Data) || '#39'.'#39' || extract(Mo' +
        'nth from Data)'
      '  || '#39'.'#39' || Extract(Year from Data) Name'
      'from CDoc order by data')
    AutoUpdateOptions.UpdateTableName = 'CDOC'
    AutoUpdateOptions.AutoReWriteSqls = True
    AutoUpdateOptions.CanChangeSQLs = True
    AutoUpdateOptions.UpdateOnlyModifiedFields = True
    AutoUpdateOptions.AutoParamsToFields = True
    AutoUpdateOptions.SeparateBlobUpdate = True
    Transaction = RT
    Database = DB
    UpdateTransaction = WT
    AutoCommit = True
    Left = 272
    Top = 128
  end
  object CDocSpec: TpFIBDataSet
    UpdateSQL.Strings = (
      'UPDATE CDOCSPEC'
      'SET '
      '    CDOC = :CDOC,'
      '    ZDOC = :ZDOC,'
      '    ANSWER = :ANSWER,'
      '    NOTE = :NOTE'
      'WHERE'
      '    CODE = :OLD_CODE'
      '    ')
    DeleteSQL.Strings = (
      'DELETE FROM'
      '    CDOCSPEC'
      'WHERE'
      '        CODE = :OLD_CODE'
      '    ')
    InsertSQL.Strings = (
      'INSERT INTO CDOCSPEC('
      '    CODE,'
      '    CDOC,'
      '    ZDOC,'
      '    ANSWER,'
      '    NOTE'
      ')'
      'VALUES('
      '    :CODE,'
      '    :CDOC,'
      '    :ZDOC,'
      '    :ANSWER,'
      '    :NOTE'
      ')')
    RefreshSQL.Strings = (
      'select '
      '  a.Code,'
      '  a.CDoc,'
      '  a.ZDoc,'
      '  a.Answer,'
      '  a.Note,'
      '  z.ZType,'
      
        '  z.Nomer || '#39' '#1086#1090' '#39' || extract(Day  from z.Data) || '#39'.'#39' || extra' +
        'ct(Month from z.Data) || '#39'.'#39' || extract(year from z.Data) || '#39'  ' +
        '  '#39' '
      '   || z.Addr || '#39'  '#39' || k.Name || '#39'  '#39' || v.Name Info  '
      'from CDocSpec a'
      'left outer join ZDoc z on (z.Code=a.ZDoc)'
      'left outer join Kontragent k on (k.Code=z.Kontragent)'
      'left outer join VType v on (v.Code=z.VType)'
      'where(A.CODE = :OLD_CODE )'
      '    ')
    SelectSQL.Strings = (
      'select '
      '  a.Code,'
      '  a.CDoc,'
      '  a.ZDoc,'
      '  a.Answer,'
      '  a.PType,'
      '  a.Note,'
      '  z.ZType,'
      '  z.Nomer zNomer,'
      '  z.Data zData,'
      '  z.Addr zAddr,'
      '  k.Name kName,'
      '  v.Name vName,'
      '  s.Name sName, '
      
        '  z.Nomer || '#39' '#1086#1090' '#39' || extract(Day  from z.Data) || '#39'.'#39' || extra' +
        'ct(Month from z.Data) || '#39'.'#39' || extract(year from z.Data) || '#39'  ' +
        '  '#39' '
      
        '   || z.Addr || '#39'  '#39' || coalesce(k.Name,'#39#39') || '#39'  '#39' || Coalesce(' +
        'v.Name,'#39#39') Info  '
      'from CDocSpec a'
      'left outer join ZDoc z on (z.Code=a.ZDoc)'
      'left outer join Kontragent k on (k.Code=z.Kontragent)'
      'left outer join VType v on (v.Code=z.VType)'
      'left outer join SType s on (s.Code=z.SType)'
      'where a.CDoc=:CDoc'
      'order by Code')
    AutoUpdateOptions.UpdateTableName = 'CDocSpec'
    AutoUpdateOptions.AutoParamsToFields = True
    AutoUpdateOptions.SeparateBlobUpdate = True
    AfterDelete = CDocSpecAfterDelete
    Transaction = RT
    Database = DB
    UpdateTransaction = WT
    AutoCommit = True
    Left = 344
    Top = 128
  end
  object SType: TpFIBDataSet
    SelectSQL.Strings = (
      'select * from SType order by Code')
    AutoUpdateOptions.UpdateTableName = 'STYPE'
    AutoUpdateOptions.KeyFields = 'Code'
    AutoUpdateOptions.AutoReWriteSqls = True
    AutoUpdateOptions.CanChangeSQLs = True
    AutoUpdateOptions.UpdateOnlyModifiedFields = True
    AutoUpdateOptions.AutoParamsToFields = True
    AutoUpdateOptions.SeparateBlobUpdate = True
    Transaction = RT
    Database = DB
    UpdateTransaction = WT
    AutoCommit = True
    Left = 96
    Top = 72
  end
  object EType: TpFIBDataSet
    UpdateSQL.Strings = (
      'UPDATE ETYPE'
      'SET '
      '    NAME = :NAME'
      'WHERE'
      '    CODE = :OLD_CODE'
      '    ')
    DeleteSQL.Strings = (
      'DELETE FROM'
      '    ETYPE'
      'WHERE'
      '        CODE = :OLD_CODE'
      '    ')
    InsertSQL.Strings = (
      'INSERT INTO ETYPE('
      '    CODE,'
      '    NAME'
      ')'
      'VALUES('
      '    :CODE,'
      '    :NAME'
      ')')
    RefreshSQL.Strings = (
      'select * from EType'
      ''
      ' WHERE '
      '        ETYPE.CODE = :OLD_CODE'
      '    ')
    SelectSQL.Strings = (
      'select * from EType')
    AutoUpdateOptions.UpdateTableName = 'ETYPE'
    AutoUpdateOptions.AutoReWriteSqls = True
    AutoUpdateOptions.CanChangeSQLs = True
    AutoUpdateOptions.UpdateOnlyModifiedFields = True
    AutoUpdateOptions.AutoParamsToFields = True
    AutoUpdateOptions.SeparateBlobUpdate = True
    Transaction = RT
    Database = DB
    UpdateTransaction = WT
    AutoCommit = True
    Left = 128
    Top = 72
  end
  object PType: TpFIBDataSet
    UpdateSQL.Strings = (
      'UPDATE PTYPE'
      'SET '
      '    NAME = :NAME'
      'WHERE'
      '    CODE = :OLD_CODE'
      '    ')
    DeleteSQL.Strings = (
      'DELETE FROM'
      '    PTYPE'
      'WHERE'
      '        CODE = :OLD_CODE'
      '    ')
    InsertSQL.Strings = (
      'INSERT INTO PTYPE('
      '    CODE,'
      '    NAME'
      ')'
      'VALUES('
      '    :CODE,'
      '    :NAME'
      ')')
    RefreshSQL.Strings = (
      'select * from PType '
      ' WHERE '
      '        PTYPE.CODE = :OLD_CODE'
      '    ')
    SelectSQL.Strings = (
      'select * from PType order by Code')
    AutoUpdateOptions.UpdateTableName = 'PType'
    AutoUpdateOptions.AutoReWriteSqls = True
    AutoUpdateOptions.CanChangeSQLs = True
    AutoUpdateOptions.UpdateOnlyModifiedFields = True
    AutoUpdateOptions.AutoParamsToFields = True
    AutoUpdateOptions.SeparateBlobUpdate = True
    Transaction = RT
    Database = DB
    UpdateTransaction = WT
    AutoCommit = True
    Left = 168
    Top = 72
  end
  object PShema: TpFIBDataSet
    UpdateSQL.Strings = (
      'UPDATE PSHEMA'
      'SET '
      '    NOMER = :NOMER,'
      '    DATA = :DATA'
      'WHERE'
      '    CODE = :OLD_CODE'
      '    ')
    DeleteSQL.Strings = (
      'DELETE FROM'
      '    PSHEMA'
      'WHERE'
      '        CODE = :OLD_CODE'
      '    ')
    InsertSQL.Strings = (
      'INSERT INTO PSHEMA('
      '    CODE,'
      '    NOMER,'
      '    DATA'
      ')'
      'VALUES('
      '    :CODE,'
      '    :NOMER,'
      '    :DATA'
      ')')
    RefreshSQL.Strings = (
      'select * from PShema '
      ' WHERE '
      '        PSHEMA.CODE = :OLD_CODE'
      '    ')
    SelectSQL.Strings = (
      'select '
      '  Code,'
      '  Nomer,'
      '  Data,'
      '  '#39#8470' '#39' || Nomer || '#39' '#1086#1090'  '#39' || extract(Day from Data) || '#39'.'#39' ||'
      
        '  Extract(Month from Data) || '#39'.'#39' || Extract(Year from Data) Nam' +
        'e'
      'from PShema order by Data')
    AutoUpdateOptions.UpdateTableName = 'PSHEMA'
    AutoUpdateOptions.AutoReWriteSqls = True
    AutoUpdateOptions.CanChangeSQLs = True
    AutoUpdateOptions.UpdateOnlyModifiedFields = True
    AutoUpdateOptions.AutoParamsToFields = True
    AutoUpdateOptions.SeparateBlobUpdate = True
    Transaction = RT
    Database = DB
    UpdateTransaction = WT
    AutoCommit = True
    Left = 208
    Top = 72
  end
  object PRType: TpFIBDataSet
    SelectSQL.Strings = (
      'select * from PRType order by Code')
    AutoUpdateOptions.UpdateTableName = 'ZDocType'
    AutoUpdateOptions.KeyFields = 'Code'
    Transaction = RT
    Database = DB
    AutoCommit = True
    Left = 152
    Top = 176
  end
  object UserList: TpFIBDataSet
    UpdateSQL.Strings = (
      'UPDATE USERLIST'
      'SET '
      '    NAME = :NAME,'
      '    ISADMIN = :ISADMIN,'
      '    ZONE = :ZONE,'
      '    USERNAME = :USERNAME,'
      '    PSW = :PSW'
      'WHERE'
      '    CODE = :OLD_CODE'
      '    ')
    DeleteSQL.Strings = (
      'DELETE FROM'
      '    USERLIST'
      'WHERE'
      '        CODE = :OLD_CODE'
      '    ')
    InsertSQL.Strings = (
      'INSERT INTO USERLIST('
      '    CODE,'
      '    NAME,'
      '    ISADMIN,'
      '    ZONE,'
      '    USERNAME,'
      '    PSW'
      ')'
      'VALUES('
      '    :CODE,'
      '    :NAME,'
      '    :ISADMIN,'
      '    :ZONE,'
      '    :USERNAME,'
      '    :PSW'
      ')')
    RefreshSQL.Strings = (
      'select * from UserList '
      ' WHERE '
      '        USERLIST.CODE = :OLD_CODE'
      '    ')
    SelectSQL.Strings = (
      'select * from UserList order by Name')
    AutoUpdateOptions.UpdateTableName = 'UserList'
    AutoUpdateOptions.AutoReWriteSqls = True
    AutoUpdateOptions.CanChangeSQLs = True
    AutoUpdateOptions.UpdateOnlyModifiedFields = True
    AutoUpdateOptions.AutoParamsToFields = True
    AutoUpdateOptions.SeparateBlobUpdate = True
    Transaction = RT
    Database = DB
    UpdateTransaction = WT
    AutoCommit = True
    Left = 152
    Top = 24
  end
end
